package com.ferry.lock.lock;

import com.ferry.lock.engine.LockEngine;

/**
 * Created by daiyong
 */
public abstract class LockBase {

	protected static final int DEFAULT_EXPIRE_TIME = -1;
	protected static final int DEFAULT_RETRY = -1;

	protected LockEngine lockEngine;
	protected String lockName;
	protected int expireTime = DEFAULT_EXPIRE_TIME;
	protected int retry = DEFAULT_RETRY;

	public LockBase(LockEngine lockEngine, String lockName, int expireTime, int retry) {
		this.lockEngine = lockEngine;
		this.lockName = lockName;
		this.expireTime = expireTime;
		this.retry = retry;
	}

	public String getLockName() {
		return lockName;
	}

	public int getExpireTime() {
		return expireTime;
	}

	public int getRetry() {
		return retry;
	}

	public abstract void switchLock();
}
